﻿@{
    ViewBag.Title = "SettMonthForYB";
    Layout = "~/Views/Shared/_Form.cshtml";
}

<div class="rows">
    <div class="panel panel-default">
        <table class="form">
            <tr>
                <th class="formTitle">申报类型：</th>
                <td class="formValue">
                    <select id="sblx" class="form-control">
                        <option value="1">医保</option>
                        <option value="2">居保</option>
                    </select>
                </td>
                <th class="formTitle">结算月份：</th>
                <td class="formValue">
                    <input id="ksrq" type="text" class="form-control input-wdatepicker formClearIgnore" style="width:90px"
                           onclick="WdatePicker({ dateFmt: 'yyyy-MM' })"
                           onfocus="WdatePicker({ dateFmt: 'yyyy-MM', onpicked: function () { refReport(); } })"
                           value="@DateTime.Now.ToString("yyyy-MM")" />
                </td>
                <th class="formTitle"></th>
                <td class="formValue" style="padding-left:20px;">
                    <input type="button" id="btn_search" onclick="submit();" class="btn btn-primary btn-md" value="查询" style="width:55px" />
                </td>
                <th></th>
                <td></td>
                <th></th>
                <td></td>
                <th></th>
                <td></td>
                <th></th>
                <td></td>
            </tr>
        </table>
    </div>
</div>

<div class="ui-layout" id="layout" style="height:100%;width:100%;">
    <iframe class="ui-layout-center" style="width:100%;" id="iframerightiframerightiframerightttt" name="iframerightiframerightiframerightttt"
            scrolling="auto" allowtransparency="true" frameborder="0"></iframe>
</div>

<script type="text/javascript">
    var reportServerHOST = '@(ViewBag.ReportServerHOST)';
    var orgId = '@(ViewBag.OrgId)';
    var isHospAdministrator = '@(ViewBag.IsHospAdministrator)';
    var curUserCode = '@(ViewBag.CurUserCode)';
    var uri = '/ReportServer/Pages/ReportViewer.aspx?%2fHIS.Report.1%2fChangshu%E5%8C%BB%E4%BF%9D%E6%9C%88%E5%BA%A6%E7%94%B3%E6%8A%A5%E6%8A%A5%E8%A1%A8&rs:Command=Render';

    function submit() {

        if ($('#ksrq').val().length == 0 ) {
            $.modalAlert("请选择日期", "error");
            return;
        }

        //同步费用
        $.ajax({
            url: "/ReportManage/Report/SettMonthForYB",
            dataType: "json",
            type: "POST",
            async: false,
            success: function (data) {
            }
        })
        var url = getUrl();
        var bdate = new Date($('#ksrq').val()).format('yyyy-MM-dd');

        url += "&Bdate=" + bdate + "&Edate=" + bdate + "&yblx=" + $('#sblx').val();

        setTimeout("$.loading(true, '正在请求报表页面...');", 10);
        $("#iframerightiframerightiframerightttt").attr('src', url);
    }

    $("#iframerightiframerightiframerightttt").load(function () {
        $.loading(false);
    });

    $(function () {
        var h = $(window).height() - 55
        $('#layout iframe').css('height', h);

    });

    //刷新列表
    function refReport() {
        $("#btn_search").trigger('click');
    }

    function getUrl() {
        if (uri.StartWith('/')) {
            uri = uri.substr(1);
        }
        var srcUrl = uri;
        srcUrl = reportServerHOST + srcUrl;

        //获取自定义样式
        if (true) {
            if (srcUrl.indexOf('&rc:Stylesheet') == -1) {
                srcUrl += "&rc:Stylesheet=MyStyleSheet";
            }
        }
        if (false) {
            srcUrl += "&curUserCode=" + curUserCode;
        }
        if (false) {
            srcUrl += "&isHospAdministrator=" + isHospAdministrator;
        }

        return srcUrl;
    }

</script>
